Skip to content

Conversation

@Hormold
Copy link
Contributor

@Hormold Hormold commented Feb 9, 2026

Summary

  • Add restart_publisher() method stub to the Room class
  • The method currently raises NotImplementedError as a placeholder until FFI bindings are added to rust-sdks

Motivation

When using the Python SDK for real-time meeting applications, we encountered a scenario where:

  1. The publisher PeerConnection gets stuck (ICE connection fails)
  2. The subscriber PeerConnection continues working normally
  3. Audio/video receiving works fine
  4. But sending data via stream_text(), publish_data(), etc. times out

Currently, there's no way to recover from this state without disconnecting the entire room, which breaks the audio streams.

The Rust SDK already has restart_publisher() at the engine level (in rtc_session.rs):

async fn restart_publisher(&self) -> EngineResult<()> {
    if self.has_published.load(Ordering::Acquire) {
        self.publisher_pc
            .create_and_send_offer(OfferOptions { ice_restart: true, ..Default::default() })
            .await?;
    }
    Ok(())
}

This PR adds a placeholder method that will be fully implemented once the FFI bindings are added.

Usage (Future)

try:
    await room.local_participant.publish_data(data)
except TimeoutError:
    # Publisher might be stuck, try to restart it
    await room.restart_publisher()
    # Retry the operation
    await room.local_participant.publish_data(data)

Implementation Status

This is a stub implementation that raises NotImplementedError:

async def restart_publisher(self) -> None:
    raise NotImplementedError(
        "restart_publisher() requires FFI bindings in livekit/rust-sdks. "
        "This is a placeholder for future implementation."
    )

Next Steps

To fully implement this feature:

  1. Add FFI bindings in livekit/rust-sdks:
    • RestartPublisherRequest, RestartPublisherResponse, RestartPublisherCallback in room.proto
    • Handler in requests.rs
    • Expose restart_publisher() on Room and RtcEngine
  2. Update the python-sdks submodule
  3. Replace the stub with the actual FFI call implementation

Test Plan

  • Method exists and is documented
  • Full implementation pending rust-sdks FFI bindings

🤖 Generated with Claude Code

@Hormold Hormold marked this pull request as draft February 9, 2026 17:11
Add `restart_publisher()` method stub to the Room class. This method will
perform an ICE restart on the publisher PeerConnection when implemented.

Use case: When sending data (stream_text/publish_data) times out but receiving
audio/video continues to work, the publisher PeerConnection may be stuck.
Currently there's no way to recover without disconnecting the entire room.

This is a placeholder that raises NotImplementedError until the corresponding
FFI bindings are added to livekit/rust-sdks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Hormold Hormold force-pushed the feat/restart-publisher branch from 8cd27d3 to cfa04b2 Compare February 9, 2026 17:17
@Hormold Hormold closed this Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant